import Vue from 'vue'
import Vuex from 'vuex'
import persistedState from 'vuex-persistedstate'

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        user: null,
        closeDrawerCount: 0,//是否关闭菜单抽屉
        answerSheetId: null,//考试id
        answerMode: 1,//答题模式 1 竖屏全 2横屏 下一题
        answeredIds: null,//已经答题的题号
    },
    mutations: {
        setUser(state, user) {
            state.user = user
        },
        closeDrawer(state) {
            state.closeDrawerCount++;
        },
        setAnswerSheetId(state, id) {
            state.answerSheetId = id
        },
        setAnswerMode(state, mode) {
            state.answerMode = mode
        },
        setAnsweredIds(state, ids) {
            state.answeredIds = ids
        },
        clearAnsweredIds(state) {
            state.answeredIds = null
        },

    },
    actions: {},
    modules: {},
    plugins: [persistedState({storage: window.sessionStorage})]
})
